import java.util.Scanner;

public class demo {

    public static void main13(String[] args) {
        int flag=1;
        for(int i=2;i<=100;i++){
            flag=1;
            for (int j = 2; j < i; j++) {
                if(i%j==0){
                    flag=0;
                    break;
                }
            }
            if(flag==1){
                System.out.println(i);
            }
        }
    }

    public static void main12(String[] args) {
        System.out.println("请输入密码:");
        int password=123456;
        int flag=3;
        Scanner sc=new Scanner(System.in);
        while(flag>0){
            int pass= sc.nextInt();
            if(pass==password){
                System.out.println("登录成功");
            }
            else {
                flag--;
                System.out.println("请重新输入(你还有"+flag+"次机会)");
            }
        }
        if(flag==0){
            System.out.println("登录失败");
        }

    }

    //水仙花数
    public static void main11(String[] args) {
        int tem,a,b,c;
        for (int i = 100; i < 1000; i++) {
            a=i%10;
            b=i/10%10;
            c=i/100;
            if(i==Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3)){
                System.out.println(i);
            }
        }
    }

    public static void main10(String[] args) {
        int count=0;
        int tem;
        for (int i = 1; i <= 1000 ; i++) {
            tem=i;
            while(tem!=0){
                if(tem%10==9){
                    count++;
                }
                tem=tem/10;
            }
        }
        System.out.println("一共出现"+count+"个9");
    }

    public static void main9(String[] args) {
        int count=0;
        for(int i=1;i<=1000;i++){
            if(i%10==9){
                count++;
            }
            if(i/10==9){
                count++;
            }
        }
        System.out.println("一共出现"+count+"个9");
    }

    public static void main8(String[] args) {
        int flag=1;
        float sum=0;
        for(float i=1;i<=100;i++){
            sum+=1/i*flag;
            flag=-flag;
        }
        System.out.println("sum="+sum);
    }

    //最大公约数
    public static void main7(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第一个数");
        int a= sc.nextInt();
        System.out.println("请输入第二个数");
        int b= sc.nextInt();
        int n=a,m=b;
        if(n<m){
            int t=n;
            n=m;
            m=t;
        }
        while(n>=m){
            int r=n%m;
            if(r==0){
                System.out.println(a+"和"+b+"最大公约数为"+m);
                break;
            }
            else{
                n=m;
                m=r;
            }
        }
    }

    public static void main6(String[] args) {
        for(int i=1;i<=9;i++){
            for(int j=1;j<=i;j++){
                System.out.print(i+"*"+j+"="+i*j+"\t");
            }
            System.out.println();
        }
    }

    public static void main5(String[] args) {
        for(int i=1000;i<=2000;i++){
            if(i%4==0&&i%100!=0||i%400==0) {
                System.out.println(i);
            }
        }
    }

    public static void main4(String[] args) {
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int flag=1;
        for(int i=2;i<num;i++)
        {
            if(num%i==0)
            {
                flag=0;
                break;
            }
        }
        if(flag==0){
            System.out.println(num+"不是素数");
        }
        else
        {
            System.out.println(num+"是素数");
        }
    }


    public static void main3(String[] args) {
        Scanner sc=new Scanner(System.in);
        int age=sc.nextInt();
        if(age<18)
        {
            System.out.println("骚年");
        }
        else if(18<=age&&age<28)
        {
            System.out.println("青年");
        }
        else if(age>=28&&age<55)
        {
            System.out.println("老年");
        }
        else
        {
            System.out.println("老年");
        }

    }

    public static void main2(String[] args) {
        int a=10,b=20,c=30,t;
        if(a<b)
        {
            t=a;
            a=b;
            b=t;
        }
        if(a<c)
        {
            t=c;
            c=a;
            a=t;
        }
        if(b<c)
        {
            t=b;
            b=c;
            c=t;
        }
        System.out.println("最大值为"+a);
        System.out.println("最小值为"+c);
    }

    public static void main1(String[] args) {
        int a=10;
        int b=20;
        int t;
        t=a;
        a=b;
        b=t;
        System.out.println(a);
        System.out.println(b);
    }


}
